#import <IOKit/IOKitLib.h>
#import <IOKit/network/IONetworkController.h>
#import <IOKit/network/IOEthernetInterface.h>
#import <IOKit/network/IONetworkInterface.h>
#import <Foundation/NSRaise.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSNumber.h>
#import <Foundation/NSData.h>
#import <Foundation/NSDictionary.h>


#if 0
@interface IOPlatformExpertDevice : NSObject 

-createCFProperty:name;

@end

@interface IOEthernetInterface : NSObject 

-initPrimary;

@end

@interface IONetworkController : NSObject 

@end

@implementation IOPlatformExpertDevice : NSObject

-createCFProperty:name {

   if([name isEqual:CFSTR(kIOPlatformSerialNumberKey)]){
     return @"Please don't steal Mac OS!";
   }
   
   return nil;
}

@end

@implementation IOEthernetInterface : NSObject

-initPrimary {
   return self;
}

-createParentEntry:name {
   if([name isEqual:CFSTR(kIOServicePlane)])
    return [[IONetworkController alloc] initPrimary];
   
   return nil;
}

@end

@implementation IONetworkController : NSObject

-initPrimary {
   return self;
}

-createCFProperty:name {

   if([name isEqual:CFSTR(kIOMACAddress)])
    return PrimaryEthernetMAC();
   
   return nil;
}

@end

#endif



const mach_port_t kIOMasterPortDefault=0;  
const mach_port_t platform_expert;

#define kIOProviderClassKey "kIOProviderClass"

CFMutableDictionaryRef IOServiceMatching(const char *name) {
   return [NSMutableDictionary dictionaryWithObject:[NSString stringWithCString:name] forKey:CFSTR(kIOProviderClassKey)];
}

io_service_t IOServiceGetMatchingService(mach_port_t masterPort,CFDictionaryRef matching) {
   NSString *type=[matching objectForKey:CFSTR(kIOProviderClassKey)];
   
   if([type isEqual:@"IOPlatformExpertDevice"])
    return (io_service_t)platform_expert;

   return 0;
}

kern_return_t IOServiceGetMatchingServices(mach_port_t	masterPort,CFDictionaryRef matching,io_iterator_t *existing) {
   return -1;
}

CFTypeRef IORegistryEntryCreateCFProperty(io_registry_entry_t entry,CFStringRef key,CFAllocatorRef allocator,IOOptionBits options) {
   return nil;
   //return [entry createCFProperty:key];
}

io_object_t IOIteratorNext(io_iterator_t iterator) {
   return 0;
}

kern_return_t IORegistryEntryGetParentEntry(io_registry_entry_t entry,const io_name_t plane,io_registry_entry_t *parent) {
   return -1;
}

kern_return_t IOObjectRelease(io_object_t object) {
	mach_port_deallocate(0,object);
}

